package com.qjc.controller;


import com.qjc.entity.Position;
import com.qjc.service.PositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author qjc
 * @since 2022-01-14
 */
@RestController
@RequestMapping("/position")
public class PositionController {

    @Autowired
    private PositionService positionService;

    /**
     * 可以直接访问： http://localhost:8222 展示页面
     */

    /**
     * http://localhost:8222/position/import/data
     */
    @GetMapping("/import/data")
    public String importData() {
        return positionService.importData();
    }

    /**
     * http://localhost:8222/position/list/java
     */
    @GetMapping("/list/{positionName}")
    public List<Position> queryByPositionName(@PathVariable String positionName) {
        return positionService.queryByPositionName(positionName);
    }

}

